﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FileFilters.cs" company="">
//   
// </copyright>
// <summary>
//   The file filters.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Libium.Core
{
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    ///   The file filters.
    /// </summary>
    public static class FileFilters
    {
        #region Static Fields

        /// <summary>
        ///   The all.
        /// </summary>
        public static readonly FileFilter All = new FileFilter { Name = "All files", MimeTypes = new MimeType[] { } };

        /// <summary>
        ///   The documents.
        /// </summary>
        public static readonly FileFilter Documents = new FileFilter
            {
               Name = "Document files", MimeTypes = MimeTypes.Documents 
            };

        /// <summary>
        ///   The images.
        /// </summary>
        public static readonly FileFilter Images = new FileFilter { Name = "Image files", MimeTypes = MimeTypes.Images };

        /// <summary>
        ///   The videos.
        /// </summary>
        public static readonly FileFilter Videos = new FileFilter { Name = "Video files", MimeTypes = MimeTypes.Videos };

        #endregion

        #region Public Methods and Operators

        /// <summary>
        /// The to string.
        /// </summary>
        /// <param name="filters">
        /// The filters. 
        /// </param>
        /// <returns>
        /// The <see cref="string"/> . 
        /// </returns>
        public static string ToString(IEnumerable<FileFilter> filters)
        {
            var builder = new StringBuilder();

            var notFirst = false;
            foreach (var filter in filters)
            {
                if (notFirst)
                {
                    builder.Append("|");
                }

                builder.Append(filter);
                notFirst = true;
            }

            return builder.ToString();
        }

        #endregion
    }
}